package com;

import com.config.AppConfig;
import com.service.AppService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        AppService appService = context.getBean(AppService.class);

        try {
            appService.add("手机", 2);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

        try {
            appService.delete("手机");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

        try {
            appService.find("电脑");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

        context.close();
    }
}